package com.iris.live.services.common.reconsitution;

/**
 *  下拉框枚举
 *  yitianle
 *  2017/4/6.
 */
public class SelectBoxOptionEnum {

    public static final int SI_TYPE_CAR = 1;
    public static final int SI_TYPE_MONTH = 2;
    public static final int SI_TYPE_QUARTER = 3;
    public static final int SI_TYPE_YEAR = 4;

    public static enum SIType {

        SI_TYPE_CAR("车辆", SelectBoxOptionEnum.SI_TYPE_CAR),
        SI_TYPE_MONTH("月", SelectBoxOptionEnum.SI_TYPE_MONTH),
        SI_TYPE_QUARTER("季度", SelectBoxOptionEnum.SI_TYPE_QUARTER),
        SI_TYPE_YEAR("年", SelectBoxOptionEnum.SI_TYPE_YEAR);
        private String name;
        private int index;
        // 构造方法
        private SIType(String name, int index) {
            this.name = name;
            this.index = index;
        }
        // 普通方法
        public static String getName(int index) {
            for (SIType c : SIType.values()) {
                if (c.index == index) {
                    return c.name;
                }
            }
            return null;
        }
        // 普通方法
        public static Integer getIndex(String name) {
            for (SIType c : SIType.values()) {
                if (c.name == name) {
                    return c.index;
                }
            }
            return null;
        }
    }
}
